<!--绑定供应商-->
<template>
    <el-dialog v-model="dialogVisible" :before-close="handleClosed" align-center width="400px">
        <el-row>
            <el-col :span="8" style="text-align: right;line-height: 30px;margin-right: 15px">
                设置供应数量
            </el-col>
            <el-col :span="8">
                <el-input-number :min="0" v-model="form.count" style="width: 150px"></el-input-number>
            </el-col>

        </el-row>
        <br>
        <el-row>
            <el-col :span="8" style="text-align: right;line-height: 30px;margin-right: 15px">
                供应备注
            </el-col>
            <el-col :span="8">
                <el-input type="textarea" v-model="form.comments" style="width: 150px"></el-input>
            </el-col>

        </el-row>
        <br>
        <el-footer style="text-align: center">
            <el-button type="primary" @click="handleAdd">确定</el-button>
            <el-button type="default" @click="handleClosed">取消</el-button>
        </el-footer>
    </el-dialog>
</template>

<script>
import supporterAPI from "@/util/request-md/supporter/supporter.js";

export default {
    emits:['callClosed'],
    props:['visible','info','details'],
    name: "BindSupporterDialog",
    watch:{
      visible(val){
          this.dialogVisible = val;
      }
    },
    data() {
        return {
            dialogVisible: false,
            form: {
                idSupport:this.info.idSupport,//供应商id
                idMat:'',//物料id
                count:0,//供应数量
                comments:'',//供应备注
            }
        }
    },
    methods:{
        handleClosed(){
            this.$emit('callClosed', false);
        },
        // loadLocalMatId(){
        //     //从本地Session中读取matId
        // },
        handleAdd(){
            // console.log(this.details,">>>>>万恶之源details");
            // console.log(this.form,">>>>>FORM数据");
            // console.log(this.info,">>>>>info数据");
            var queryData = {
                idSupport: this.info.idSupport,
                idMat: this.details.id,
                count: this.form.count,
                comments: this.form.comments
            }
            console.log(queryData,">>>>>>请求数据");
            supporterAPI.addMatSupporter(queryData, (res) => {
                if (res.code === 200) {
                    this.$message({
                        type: 'success',
                        message: '绑定成功!'
                    });
                }
            })
        }
    },
    mounted() {

    }
};
</script>

<style scoped>
.info{
    /*margin-right: 10px;*/
    color: #909399;
}
.info-container{
}
</style>